package Code;

/**
 * @author zihao
 * @date 2025/3/18 20:08
 * @VERSION
 * @description
 **/
public class Calculation {
    public int num1;
    public int num2;

    //行为
    //加法
    public void add(){
        System.out.println("两个数字的和是"+(num1+num2));
    }
    //减法
    public void sub(){
        System.out.println("两个数字相减是"+(num1-num2));
    }
    //乘法
    public void times(){
        System.out.println("两个数字的积是"+(num1*num2));
    }
    //除法
    public void div(){
        System.out.println("两个数字相除是"+(num1/num2));
    }
    //构造方法
    //无参构造
    public Calculation() {
    }
    //满参构造
    public Calculation(int num1, int num2) {
        this.num1 = num1;
        this.num2 = num2;
    }
    //getter and setter
    public int getNum1() {
        return num1;
    }

    public void setNum1(int num1) {
        this.num1 = num1;
    }

    public int getNum2() {
        return num2;
    }

    public void setNum2(int num2) {
        this.num2 = num2;
    }
    //main方法
    public static void main(String[] args) {
        Calculation calculation=new Calculation();
        calculation.setNum1(12);
        calculation.setNum2(3);
        calculation.getNum1();
        calculation.getNum2();
        calculation.add();
        calculation.sub();
        calculation.times();
        calculation.div();
    }
}
